using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_updCompany : System.Web.UI.Page
{
    string xmlPath;

    protected void Page_Load(object sender, EventArgs e)
    {
        //load xml
        xmlPath = Server.MapPath(@"~\App_Data\Info.xml");
        if (!IsPostBack)
        {
            Info dto = new InfoBus().GetInfo(xmlPath);

            txtCompany.Text = dto.CompanyName;
            txtEmail.Text = dto.AdmEmail;
            txtAddress.Text = dto.Address;
            txtPhone.Text = dto.Phone;
            oEdit.Text = dto.About;
        }
    }

    Info GetInfo()
    {
        Info dto = new Info();
        dto.CompanyName = txtCompany.Text;
        dto.AdmEmail = txtEmail.Text;
        dto.Address = txtAddress.Text;
        dto.Phone = txtPhone.Text;
        dto.About = oEdit.Text;
        return dto;
    }

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Info dto = GetInfo();
        new InfoBus().SaveXml(dto, xmlPath);
    }
}
